﻿using System.Windows;
using System.Windows.Controls;
using TianlalaHSB.ViewModels;

namespace TianlalaHSB.Views;

/// <summary>
///     LoginView.xaml 的交互逻辑
/// </summary>
public partial class LoginView : Window
{
    public LoginView()
    {
        InitializeComponent();
        var loginViewModel = new LoginViewModel
        {
            CloseWindowAction = Close // 订阅关闭窗口的委托
        };
        DataContext = loginViewModel;
    }

    private void PasswordChanged(object sender, RoutedEventArgs e)
    {
        if (sender is PasswordBox box && DataContext is LoginViewModel viewModel) viewModel.password = box.Password;
    }
}